using System;
using System.Collections.Generic;
using Mbs.ComponentModel.Container.Metadata;

namespace Mbs.ComponentModel.Container.Context
{
    [Serializable]
    public class CreateContext : ICreateContext
    {
        public IMicroKernel Kernel { get; private set; }
        public IComponentInfo Component { get; internal set; }
        public IDictionary<string, object> NamedArgs { get; private set; }
        public object[] Args { get; private set; }
        public Type[] GenericParameters { get; internal set; }

        internal CreateContext(IKernel kernel, Type[] gernericParameters)
        {
            Kernel = kernel;
            GenericParameters = gernericParameters;
        }

        internal ICreateContext Init(IComponentInfo info)
        {
            Component = info;
            
            return this;
        }

        public CreateContext(IMicroKernel kernel, IComponentInfo info, IDictionary<string, object> args, Type[] genericParameters)
        {
            Kernel = kernel;
            Component = info;
            NamedArgs = args;
            GenericParameters = genericParameters;
        }

        public CreateContext(IMicroKernel kernel, IComponentInfo info, object[] args, Type[] genericParameters)
        {
            Kernel = kernel;
            Component = info;
            Args = args;
            GenericParameters = genericParameters;
        }

        public CreateContext(IComponentInfo info, object[] args)
        {
            Component = info;
            Args = args;
        }
    }
}
